class OCRProcessingError(Exception):
    """OCR处理基础异常类"""

    def __init__(self, message: str, error_code: str = "OCR_PROCESSING_ERROR"):
        self.message = message
        self.error_code = error_code
        super().__init__(self.message)


class ModelInitializationError(OCRProcessingError):
    """模型初始化异常"""

    def __init__(self, message: str):
        super().__init__(message, "MODEL_INIT_ERROR")


class ImageProcessingError(OCRProcessingError):
    """图像处理异常"""

    def __init__(self, message: str):
        super().__init__(message, "IMAGE_PROCESSING_ERROR")


class InvalidInputError(OCRProcessingError):
    """无效输入异常"""

    def __init__(self, message: str):
        super().__init__(message, "INVALID_INPUT_ERROR")


class ModuleNotFoundError(OCRProcessingError):
    """模块未找到异常"""

    def __init__(self, module_name: str):
        message = f"Required module '{module_name}' not found or not properly configured"
        super().__init__(message, "MODULE_NOT_FOUND_ERROR")


class ConfigurationError(OCRProcessingError):
    """配置错误异常"""

    def __init__(self, message: str):
        super().__init__(message, "CONFIGURATION_ERROR")
